package com.gksc.video.enums;

/**
 * @className: StreamType
 * @description: 视频流类型枚举类
 * @author: Liao.yx
 * @email: 1229053515@qq.com
 * @create: 2021年05月14日 16时01分
 * @copyRight: 2020 liaoyongxiang All rights reserved.
 **/
public enum StreamType {
    SUB(0, "sub", "子码流"),
    MAIN(1, "main", "主码流");

    /**
     * 类型
     */
    private int type;
    /**
     * 类型编码
     */
    private String code;
    /**
     * 说明
     */
    private String desc;

    StreamType(int type, String code, String desc) {
        this.type = type;
        this.code = code;
        this.desc = desc;
    }

    public int getType() {
        return type;
    }

    public String getCode() {
        return code;
    }

    public static String getStreamTypeCode(int val) {
        for (StreamType item : StreamType.values()) {
            if (val == item.getType()) {
                return item.getCode();
            }
        }
        return StreamType.MAIN.getCode();
    }
}
